﻿@{
	ViewBag.Title = "检查申请单";
	Layout = "~/Views/Shared/_Form.cshtml";
	var pacsopenURL = Newtouch.Core.Common.Utils.ConfigurationHelper.GetAppConfigValue("pacsOpenUrl");
}

<form id="formPatSer" style="margin:2px;margin-top:10px;">
    <div class="panel panel-default">
        <div>
            <table class="form">
                <tr>
                    <th class="formTitle">申请单时间范围：</th>
                    <td class="formValue" colspan="2">
                        <input id="kssj" type="text" class="form-control input-wdatepicker" style="width:30%;  float:left;" value="@DateTime.Now.ToString("yyyy-MM-dd")" onfocus="WdatePicker({ dateFmt: 'yyyy-MM-dd' })" />
                        <span style="margin-left:1%;float:left">—</span>
                        <input id="jssj" type="text" class="form-control input-wdatepicker" style="width:30%; float:left;margin-left:1%;" value="@DateTime.Now.ToString("yyyy-MM-dd")" onfocus="WdatePicker({ dateFmt: 'yyyy-MM-dd' })" />
                    </td>
                    <th class="formTitle">组套名称：</th>
                    <td class="formValue">
                        <input id="txt_ztmc" type="text" class="form-control" placeholder="组套名称" />
                    </td>
                    <td class="formTitle">
                        <input type="button" id="btn_search" class="btn btn-md btn-primary" value="查询" />
                    </td>

                </tr>
            </table>
        </div>
    </div>
    <div class="gridPanel">
        <table id="gridList" rel="formPatSer"></table>
        <div id="gridPager" style="padding-right:20%"></div>
    </div>
</form>
<script lang="javascript">
    var mzzyh = $.request("mzzyh");
    var type = $.request("type");
    $(function () {
        gridList();

    })
    $(document).ready(function () {
        $("#btn_search").trigger('click');
    });
    $("#btn_search").click(function () {
        var kssj = $('#kssj').val();
        var jssj = $('#jssj').val() + " 23:59:59";
        var ztmc = $('#txt_ztmc').val();
        $("#gridList").jqGrid('setGridParam', {
            postData: { mzzyh: mzzyh, type: type, ztmc: ztmc, kssj: kssj, jssj: jssj },
        }).trigger('reloadGrid'); //重新加载当前表格
    });
    function gridList() {
        var kssj = $('#kssj').val();
        var jssj = $('#jssj').val() + " 23:59:59";
        var ztmc = $('#txt_ztmc').val();
        var $gridList = $("#gridList");
        $gridList.dataGrid({
            url: "/MedicalRecord/GetPacsSqdhGridJson",
            autowidth: false,
            postData: { mzzyh: mzzyh, type: type, ztmc: ztmc, kssj: kssj, jssj: jssj },
            width: $(window).width()-10,
            height: $(window).height() - 100,
            colModel: [
                { label: '姓名', name: 'xm', align: 'left', hidden: true },
               //{ label: '性别', name: 'xb', align: 'left', hidden: true },
               { label: '申请单号', name: 'lissqdh', align: 'left' },
                { label: '组套名称', name: 'ztmc', align: 'left' },
               { label: '申请时间', name: 'sqsj', align: 'left' },
               { label: '申请单状态', name: 'syncStatus', align: 'left' },
                //{ label: 'ztId', name: 'ztId', hidden: true },
               {
                    label: "操作", name: "", align: "center", width: 100,
                    formatter: function (cellvalue, options, rowobject) {
                        return "<a href=\#\" onclick='recall1(\"" + rowobject.lissqdh + "\",\"" + rowobject.syncStatus + "\")'' title='查看报告' style='text-decoration: none;color: #dd4b39;cursor: pointer;'>查看报告</a>";
                    }
                }
               //{ label: '总金额', name: 'zje' ,align: 'left'}
            ],
            pager: "#gridPager",
            sortname: 'sqsj desc',
            viewrecords: true
        });
    }
    function recall1(sqdh, syncStatus )
    {
		if (syncStatus != "己出报告" && syncStatus != "等待报告") {
            $.modalAlert("当前状态不是已完成状态不能查看报告", 'warning');
            return;
        }
        else {
			window.open('@pacsopenURL'+"DepExamViewer/#/?hisreqid=" + sqdh+"", "height=800, width=1195,top=100, left=50, toolbar =no, menubar=no, scrollbars=yes, resizable=yes, location=no, status=no");
            //$.modalOpen({
            //    id: "medicaljgForm",
            //    title: "检查报告",
            //    url: "https://202.127.1.101:9901/DepExamViewer/?patid='" + sqdh+"'" ,
            //    width: "1000px",
            //    height: "1000px",
            //    btn: ['', ''],
            //    btnclass: ['', ''],
            //});
        }
        
    }
    //jqGrid 双击选中某行
    function btn_edit() {
        var $gridList = $("#gridList");
        if ($gridList.jqGridRowValue().syncStatus != "己出报告") {
            $.modalAlert("当前状态不是已完成状态不能查看报告", 'warning');
            return;
        }
        else {
             @*$.najax({
                url: "@Url.Action("OpenExe")",
                dataType: "json",
                 data: { sqdh: $gridList.jqGridRowValue().lissqdh },
                async: true,    
                type: "POST",
                success: function () {
                    //callback(false);
                }, error: function () {
                    //callback(true);
                }
            });*@
            $.modalOpen({
                id: "medicaljgForm",
                title: "检查报告",
                url: "http://192.168.3.17:8088/WebSearch.aspx?ReqNO='" + sqdh + "'",
                width: "1000px",
                height: "800px",
                btn: ['', ''],
                btnclass: ['', ''],
            });
        }

    }
</script>
